package org.jivesoftware.smackx.packet;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smackx.ChatState;
import org.xmlpull.v1.XmlPullParser;

public class ChatStateExtension
  implements PacketExtension
{
  private ChatState state;

  public ChatStateExtension(ChatState paramChatState)
  {
    this.state = paramChatState;
  }

  public String getElementName()
  {
    return this.state.name();
  }

  public String getNamespace()
  {
    return "http://jabber.org/protocol/chatstates";
  }

  public String toXML()
  {
    return "<" + getElementName() + " xmlns=\"" + getNamespace() + "\" />";
  }

  public static class Provider
    implements PacketExtensionProvider
  {
    public PacketExtension parseExtension(XmlPullParser paramXmlPullParser)
      throws Exception
    {
      ChatState localChatState;
      try
      {
        localChatState = ChatState.valueOf(paramXmlPullParser.getName());
      }
      catch (Exception localException)
      {
        localChatState = ChatState.active;
      }
      return new ChatStateExtension(localChatState);
    }
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smackx.packet.ChatStateExtension
 * JD-Core Version:    0.6.1
 */